from app.BaseUsecase import BaseUsecase
import yaml,os
class YamlUsecase(BaseUsecase):
    """
    yaml用例加载实现
    """
    def load(self,config):
        res = []
        dir = config['usecaseDir']
        for root,dirs,files in os.walk(dir):
            for file in files:
                if os.path.splitext(file)[1] in ['.yaml','.yml']:
                    with open(os.path.join(root,file),'r',encoding="utf-8") as f:
                        config = yaml.load(f,Loader=yaml.FullLoader)
                        res.append(config)
        return res
